<template>
  <div>
    <div classs="content">
      <div></div>
      <div class="class-table">
        <div class="table-wrapper">
          <div class="tabel-container">
            <table align="center" style="width: 100%;">
              <thead>
              <tr>
                <th colspan="2" width="48" class="fw">课时</th>
                <th class="fw" v-for="(item, index) in datelist" :key="index">
                  <p>{{ item.week }}</p>
                  <p class="fonts">{{ item.date }}</p>
                </th>
              </tr>
              </thead>
              <tbody>
              <tr v-for="(item,index) in coursesArr" :key="index">
                <td rowspan="4" class="wd amtdstyle" v-if="index==0">
                  <div class="fw">上</div>
                  <div class="amstle">午</div>
                </td>
                <td rowspan="4" class="wd pmtdstyle"  v-if="index==4">
                  <div class="fw">下</div>
                  <div class="amstle">午</div>
                </td>
                <td class="wd fw">{{index+1}}</td>
                <td v-for="(item2,index2) in item" @click="courseClick(index,index2,item2)">{{item2&&item2.coursename}}</td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ScheduleTable",
  props:{
    courses:{
      type:Array,
      default:function (){
        return []
      }
    }
  },
  watch:{
    courses(newVal, oldVal){
      this.coursesArr=newVal
    }
  },
  data() {
    return {
      coursesArr:this.courses,
      total: 0,
      currentPage: 1,
      act: "0",
      activeIndex: "",
      i: "",
      gradeIndex: "",
      tableData: [],
      datelist: [
        {
          id: "1",
          week: "星期一",
        },
        {
          id: "2",
          week: "星期二",
        },
        {
          id: "3",
          week: "星期三",
        },
        {
          id: "4",
          week: "星期四",
        },
        {
          id: "5",
          week: "星期五",
        },
        {
          id: "6",
          week: "星期六",
        },
        {
          id: "7",
          week: "星期日",
        },
      ]
    };
  },

  created() {},

  methods: {
    studyingall(i) {
      this.activeIndex = i;
    },
    studyingchangeTab(i) {
      this.activeIndex = i;
    },
    phaseall(i) {
      this.i = i;
    },
    phasetab(i) {
      this.i = i;
    },
    courseClick(val,val2,info){
      this.$emit("editCourse",val,val2,info)
    }
  }
}
</script>

<style lang="scss" scoped>
.class-table {
  padding: 24px;
  background: #fff;
  .table-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
  }
}
.wd {
  width: 48px !important;
}
table {
  border: 1px solid #f3f3f3;
  border-collapse: collapse;
  text-align: center;
}
tr,
th,
td {
  width: 150px;
  height: 65px;
  font-size: 12px;
  text-align: center;
  border: 1px solid #f3f3f3;
}
td:hover {
  position: relative;
  background: #e7f7f4;
  .dis {
    display: block;
    text-align: center;
    margin: 0 auto;
    cursor: pointer;
  }
}



.wd:hover {
  background-color: #fff;
}
.amtdstyle:hover {
  background-color: #e7f7f4;
}
.pmtdstyle:hover {
  background-color: #fce6bc;
}
.fw {
  font-size: inherit;
  font-weight: 600;
}
.dis {
  display: none;
}
.fonts {
  font-weight: 400;
  font-size: 10px;
  color: #9899a1;
}
.amstle {
  padding-top: 200px;
  font-size: 16px;
  font-weight: 600;
}
.amtdstyle {
  background: #e7f7f4;
  color: #2e8759;
  border-right: 0;
}
.pmtdstyle {
  background: #fce6bc;
  color: #ff7844;
  border-right: 0;
}
/deep/ .el-button {
  width: 128px;
  height: 38px;
  background: #00c15d;
  border-radius: 8px;
}

</style>